package run.siyuan.rabbitmq.canal.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import run.siyuan.common.constant.rabbitmq.Constants;

@RestController
@RequestMapping("/canal")
public class CanalQueueController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping(value = "/send")
    public String clearVipInfo(@RequestParam(value = "msg", defaultValue = "no message") String msg) {
        rabbitTemplate.convertAndSend(Constants.Queue.RABBITMQ_SIYUAN_CANAL_EXCHANGE_QUEUE, msg);
        return "success";
    }
}
